package cn.jwt.controller;




import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class UserController {



    //security权限方法
    @RequestMapping(value = {"/","/hello"})
    @PreAuthorize("hasAuthority('system:dept:list')")
    public String hello(){
        return "你好啊！";
    }


    //自定义权限方法
    @RequestMapping(value = {"/MyAuthority"})
    @PreAuthorize("@MyAuthority.hasAuthority('system:dept:list')")
    public String myAuthority(){
        return "自定义权限方法！";
    }



}
